package ro.pub.cs.client.settings;

import ro.pub.cs.client.data.Homework;

import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel;

public class HomeworkItem extends Composite {
	private HorizontalPanel hPanel = new HorizontalPanel();
	
	private HTML nameText = new HTML();
	private HTML descText = new HTML();
	
	private Button editButton = new Button("Edit");
	private Button deleteButton = new Button("Delete");
	
	public HomeworkItem(Homework homework) {
		nameText.setText(homework.name);
		descText.setText("(Homework description)");
		
		VerticalPanel descPanel = new VerticalPanel();
		descPanel.add(nameText);
		descPanel.add(descText);
		
		VerticalPanel opPanel = new VerticalPanel();
		opPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);
		opPanel.add(editButton);
		opPanel.add(deleteButton);
		
		hPanel.add(descPanel);
		hPanel.add(opPanel);
		hPanel.setCellHorizontalAlignment(descPanel, HorizontalPanel.ALIGN_LEFT);
		hPanel.setCellHorizontalAlignment(opPanel, HorizontalPanel.ALIGN_RIGHT);
		hPanel.setWidth("100%");
		
		initWidget(hPanel);
	}
}
